package cn.keduox.dao.impl;

import cn.keduox.entity.BookRecommend;
import cn.keduox.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * User: Yongman
 * Date: 2017/12/31
 */
public class BookRecDao {
    /**
     * 查询推荐书目
     * @return 返回数目集合
     */
    public List<BookRecommend> query(){
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            con = JDBCUtils.getConnection();
            String sql = "SELECT * FROM `book_recommend`";
            ps = con.prepareStatement(sql);
            rs = ps.executeQuery();
            BookRecommend br = new BookRecommend();
            List<BookRecommend> bookRecommends = new ArrayList<>();
            while (rs.next()){
                br.setId(rs.getString("id"));
                br.setBookId(rs.getString("id"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }


}
